package com.jiazhong.basic.shuxin.thread.b;

import lombok.SneakyThrows;

public class Consumer implements Runnable {

    private Broker broker;

    public Consumer(Broker broker) {
        this.broker = broker;
    }

    @SneakyThrows
    public void run() {
        for (int i = 0; i < 20; i++) {
            Goods sell = broker.sell();
            System.out.println("消费者购买了：" + sell);
            Thread.sleep(3000);
        }
    }
}
